<?
//先通过dirname(__FILE__)获取到当前文件绝对路径，然后再按具体情况用..去控制找到templates文件夹下的header.php
include dirname(__FILE__)."/../templates/header.php";
?>

<link type="text/css" rel="stylesheet" href="<? echo base_url() ?>css/admin/category.css" />

<script type="text/javascript" src="<? echo base_url() ?>js/ztree/jquery.ztree.all-3.2.js"></script>

<script type="text/javascript">


$(document).ready(
	function(){

		//保存按钮
		$("#btnSub").click(
			function(){

				if(! abhxCommonValidate($("#updateForm"))){
					return false;
				}
				$("#updateForm").get(0).submit();
			}
		);
	}
);

</script>

<table cellspacing="1" cellpadding="3" class="title title2">
	<tr>
		<td>修改本栏目</td>
	</tr>
</table>
<form id="updateForm" method="post" action="<? echo base_url() ?>index.php/category/update">

	<!--本栏目id-->
	<input type="hidden" name="id" value="<? echo $category->id ?>" />
	<!--父栏目id-->
	<input type="hidden" name="parent_category_id" value="<? echo $category->parent_category_id ?>" />

	<dl>
		<dt>
			<label for="name">栏目名称</label>
		</dt>
		<dd>
			<input type="text" name="name" size="22" maxlength="50" value="<? echo $category->name ?>"
				 abhxValid="true" abhxValidType="text,required" abhxValidName="栏目名称"/>
		</dd>
	</dl>
	<dl>
		<dt>
			<label for="name">展示类型</label>
		</dt>
		<dd>
			<select name="category_type_id" abhxValid="true" abhxValidType="required" abhxValidName="展示类型">
			    <option value="">请选择</option>
			    <option value="1" <? if($category->category_type_id == "1"){ echo "selected" ; } ?>>单篇</option>
			    <option value="2" <? if($category->category_type_id == "2"){ echo "selected" ; } ?>>列表</option>
			    <option value="3" <? if($category->category_type_id == "3"){ echo "selected" ; } ?>>图片</option>
			</select>
		</dd>
	</dl>
	<dl>
		<dt>
			<label for="category_id">显示顺序</label>
		</dt>
		<dd>
			<input type="text" name="order_no" size="5" value="<? echo $category->order_no ?>"
				 abhxValid="true" abhxValidType="int,required" abhxValidName="显示顺序"/>
		</dd>
	</dl>
	<div class="clear"></div>
	<div class="contentDiv">
		<input type="button" id="btnSub" value=" 修 改 " title="确认修改"/>&nbsp;
				<input type="reset" id="btnReset" value=" 重 置 " title="清空所输入的内容"/>
	</div>

</form>
<? if($info != "no"){
?>
<script type='text/javascript'>
	alert("<? echo $info ?>");

	var treeObj = window.parent.parent.treeFrame.zTree ;

	var nodes = treeObj.getNodesByParam("id", "<? echo $category->id ?>", null);
	if (nodes.length>0) {
		treeObj.reAsyncChildNodes(nodes[0].getParentNode(), "refresh");
	}else{
		//获取根目录
		nodes = treeObj.getNodesByParam("id", "0", null);
		treeObj.reAsyncChildNodes(nodes[0], "refresh");
	}

</script>
<? } ?>
